<template>
  <div class="search-bar">
    <el-form :inline="true" :model="formItem" class="form-filter" size="mini">
      <el-form-item>
        <el-radio-group v-model="formItem.s_disabled" @change="search">
          <el-radio-button key="all" label="">全部</el-radio-button>
          <el-radio-button key="false" label="false">启用</el-radio-button>
          <el-radio-button key="true" label="true">停用</el-radio-button>
        </el-radio-group>
      </el-form-item>
      <el-form-item>
        <el-select v-model="formItem.s_institutionCode" clearable placeholder="请选择巡检厅局" size="mini" @change="search">
          <el-option v-for="(item) in institutions" :key="item.code" :label="item.name " :value="item.code" />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button plain icon="el-icon-search" @click="search" />
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
// import { list } from '@neu/dcom-ui/api/institutions'
// 定义一个查询表单原始项
const formItem = {
  s_disabled: '',
  s_institutionCode: ''
}

export default {
  name: 'HnInspectionFilter',
  data() {
    return {
      formItem: {
        ...formItem
      },
      /** 机构 */
      institutions: []

    }
  },
  created() {
    // list().then(res => {
    //   if (res.status === 'success') {
    //     this.types = res.data
    //   }
    // })
    this.institutions = this.$store.getters['dcom/projectUserInfo'].institutions
  },
  mounted() {
  },
  methods: {
    // 查询按钮点击事件处理
    search: function() {
      this.$parent.filter(this.formItem)
    },
    // 重置按钮点击事件处理
    reset: function() {
      this.formItem = {
        ...formItem
      }
      this.search()
    },
    onChange: function(val) {
      this.$parent.onResize()
    },
    onGlobeSearchInputChange(value) {
      if (value === '') {
        this.search()
      }
    }
  }
}
</script>
